import 'dart:convert';
import 'package:ichinesereader/models/common/Settings.dart';

ClassDetailsDto classDetailsUpdateDtoFromJson(String str) =>
    ClassDetailsDto.fromJson(json.decode(str));
String classDetailsUpdateDtoToJson(ClassDetailsDto data) =>
    json.encode(data.toJson());

// String classDetailsUpdateDtoToJsonForAdminUpdateClass(ClassDetailsDto data) => json.encode(data.toJsonForAdminUpdateClass());
class ClassDetailsDto {
  ClassDetailsDto({
    this.classId,
    this.className,
    this.level,
    this.programId,
    this.schoolAdmin,
    this.settings,
    this.teacherUserNames,
    this.viewReport,
    this.quizThreshold,
    this.interfaceChinese,
  });

  String? classId;
  String? className;
  String? level;
  String? programId;
  String? schoolAdmin;
  Settings? settings;
  List<String>? teacherUserNames;
  bool? viewReport;
  int? quizThreshold;
  bool? interfaceChinese;

  factory ClassDetailsDto.fromJson(Map<String, dynamic> json) =>
      ClassDetailsDto(
          classId: json["classId"],
          className: json["className"],
          level: json["level"],
          programId: json["programId"],
          schoolAdmin: json["schoolAdmin"],
          settings: json["settings"] != null
              ? Settings.fromJson(json["settings"])
              : null,
          teacherUserNames: json["teacherUserNames"] != null
              ? List<String>.from(json["teacherUserNames"].map((x) => x))
              : null,
          viewReport: json["viewReport"],
          quizThreshold: json['quizThreshold'],
          interfaceChinese: json['interfaceChinese']);

  Map<String, dynamic> toJson() => {
        "classId": classId,
        "className": className,
        "level": level,
        "programId": programId,
        "schoolAdmin": schoolAdmin,
        "settings": settings != null ? settings?.toJson() : null,
        "teacherUserNames": teacherUserNames != null
            ? List<dynamic>.from(teacherUserNames!.map((x) => x))
            : null,
        "viewReport": viewReport,
        "quizThreshold": quizThreshold,
        'interfaceChinese': interfaceChinese
      };
}
